use ::libc;
extern "C" {
    fn memcmp(_: *const libc::c_void, _: *const libc::c_void, _: libc::c_ulong) -> libc::c_int;
    fn utf8_towc(_: *const utf8_data, _: *mut wchar_t) -> utf8_state;
    fn utf8_in_table(_: wchar_t, _: *const wchar_t, _: u_int) -> libc::c_int;
}
pub type __u_char = libc::c_uchar;
pub type __u_int = libc::c_uint;
pub type u_char = __u_char;
pub type u_int = __u_int;
pub type wchar_t = libc::c_int;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct utf8_data {
    pub data: [u_char; 21],
    pub have: u_char,
    pub size: u_char,
    pub width: u_char,
}
pub type utf8_state = libc::c_uint;
pub const UTF8_ERROR: utf8_state = 2;
pub const UTF8_DONE: utf8_state = 1;
pub const UTF8_MORE: utf8_state = 0;
static mut utf8_modifier_table: [wchar_t; 31] = [
    0x1f1e6 as libc::c_int,
    0x1f1e7 as libc::c_int,
    0x1f1e8 as libc::c_int,
    0x1f1e9 as libc::c_int,
    0x1f1ea as libc::c_int,
    0x1f1eb as libc::c_int,
    0x1f1ec as libc::c_int,
    0x1f1ed as libc::c_int,
    0x1f1ee as libc::c_int,
    0x1f1ef as libc::c_int,
    0x1f1f0 as libc::c_int,
    0x1f1f1 as libc::c_int,
    0x1f1f2 as libc::c_int,
    0x1f1f3 as libc::c_int,
    0x1f1f4 as libc::c_int,
    0x1f1f5 as libc::c_int,
    0x1f1f6 as libc::c_int,
    0x1f1f7 as libc::c_int,
    0x1f1f8 as libc::c_int,
    0x1f1f9 as libc::c_int,
    0x1f1fa as libc::c_int,
    0x1f1fb as libc::c_int,
    0x1f1fc as libc::c_int,
    0x1f1fd as libc::c_int,
    0x1f1fe as libc::c_int,
    0x1f1ff as libc::c_int,
    0x1f3fb as libc::c_int,
    0x1f3fc as libc::c_int,
    0x1f3fd as libc::c_int,
    0x1f3fe as libc::c_int,
    0x1f3ff as libc::c_int,
];
#[no_mangle]
pub unsafe extern "C" fn utf8_has_zwj(mut ud: *const utf8_data) -> libc::c_int {
    if ((*ud).size as libc::c_int) < 3 as libc::c_int {
        return 0 as libc::c_int;
    }
    return (memcmp(
        ((*ud).data)
            .as_ptr()
            .offset((*ud).size as libc::c_int as isize)
            .offset(-(3 as libc::c_int as isize)) as *const libc::c_void,
        b"\xE2\x80\x8D\0" as *const u8 as *const libc::c_char as *const libc::c_void,
        3 as libc::c_int as libc::c_ulong,
    ) == 0 as libc::c_int) as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn utf8_is_zwj(mut ud: *const utf8_data) -> libc::c_int {
    if (*ud).size as libc::c_int != 3 as libc::c_int {
        return 0 as libc::c_int;
    }
    return (memcmp(
        ((*ud).data).as_ptr() as *const libc::c_void,
        b"\xE2\x80\x8D\0" as *const u8 as *const libc::c_char as *const libc::c_void,
        3 as libc::c_int as libc::c_ulong,
    ) == 0 as libc::c_int) as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn utf8_is_vs(mut ud: *const utf8_data) -> libc::c_int {
    if (*ud).size as libc::c_int != 3 as libc::c_int {
        return 0 as libc::c_int;
    }
    return (memcmp(
        ((*ud).data).as_ptr() as *const libc::c_void,
        b"\xEF\xB8\x8F\0" as *const u8 as *const libc::c_char as *const libc::c_void,
        3 as libc::c_int as libc::c_ulong,
    ) == 0 as libc::c_int) as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn utf8_is_modifier(mut ud: *const utf8_data) -> libc::c_int {
    let mut wc: wchar_t = 0;
    if utf8_towc(ud, &mut wc) as libc::c_uint != UTF8_DONE as libc::c_int as libc::c_uint {
        return 0 as libc::c_int;
    }
    if utf8_in_table(
        wc,
        utf8_modifier_table.as_ptr(),
        (::core::mem::size_of::<[wchar_t; 31]>() as libc::c_ulong)
            .wrapping_div(::core::mem::size_of::<wchar_t>() as libc::c_ulong) as u_int,
    ) == 0
    {
        return 0 as libc::c_int;
    }
    return 1 as libc::c_int;
}
